//
//  HTSubjectItem.swift
//  MagaCore
//
//  Created by MrMessy on 2023/5/4.
//

import SwiftUI

struct HTSubjectItem: View {

  var var_anime: HTAnime = HTAnime()
  var var_showDUB: Bool = false

  var body: some View {
    VStack(spacing: 0){
      HTCoverView(var_anime: var_anime, var_showDUB: var_showDUB, var_cornerRadius: 0)
      VStack(alignment: .leading, spacing: 3){
        HStack(alignment: .top) {
          Text(var_anime.var_title ?? "")
            .font(.system(size: UIDevice.ht_fixToWidth(width: 12)))
            .fontWeight(.bold)
            .ht_normal()
            .lineLimit(2)
            .lineSpacing(4)
            .multilineTextAlignment(.leading)
        }
        .frame(maxWidth: .infinity, maxHeight: UIDevice.ht_fixToWidth(width: 36), alignment: .topLeading)

        Text(var_anime.ht_subTitle())
          .font(.system(size: UIDevice.ht_fixToWidth(width: 10)))
          .fontWeight(.bold)
          .lineLimit(1)
          .frame(height: UIDevice.ht_fixToWidth(width: 14))
          .foregroundColor(Color(hex: "#FF6C3C"))
          .frame(maxWidth: .infinity, alignment: .leading)
      }
      .frame(maxWidth: .infinity)
      .padding(4)
    }
    .frame(width: UIDevice.ht_fixToWidth(width: 108))
    .background(Color.white)
    .cornerRadius(UIDevice.ht_fixToWidth(width: 6))
  }
}
